<template>
  <div class="detailParams">
    <div class="ruleParams">
      <h5>{{ruleParams.key}}</h5>
      <ul>
        <li v-for="(item,index) in ruleParamsArray" :key="index">
          <span class="typeName" v-for="(value,index) in item" :key="index">{{value}}</span>
        </li>
      </ul>
			<p class="ruleTips">{{ruleParams.disclaimer}}</p>
    </div>
    <div class="infoParams">
      <h5>{{infoParams.key}}</h5>
      <ul>
        <li v-for="(item,index) in infoParams.set" :key="index">
          <span class="typeName">{{item.key}}</span>
          <span class="typeName">{{item.value}}</span>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: "DetailParams",
  props: {
    detailItemParams: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  data() {
    return {
      infoParams: [],
			ruleParams: {},
			ruleParamsArray:[]
    };
  },
  watch: {
    detailItemParams() {
      this.infoParams = this.detailItemParams.info;
      this.ruleParams = this.detailItemParams.rule;
      this.ruleParamsArray = this.detailItemParams.rule.tables[0];
    }
  }
};
</script>

<style scoped>
.detailParams {
  padding: 0 6px 10px 18px;
}
.ruleParams, .infoParams{
  margin: 10px 0 20px;
  border-bottom: 2px solid #ccc;
}
.detailParams h5 {
  text-align: center;
  font-size: 16px;
  height: 30px;
  line-height: 30px;
  margin-bottom: 10px;
}
.detailParams li {
  height: 40px;
  line-height: 40px;
  border-bottom: 1px solid #ccc;
  display: flex;
  font-size: 14px;
}
.ruleParams li > span.typeName {
  text-align: center;
  flex: 1;
  padding-right: 15px;
	overflow: hidden;
}
.ruleParams li > span:nth-child(1) {
  text-align: left;
  flex: 2;
  padding-right: 0px;
}
.ruleParams .ruleTips{
	font-size: 14px;
	color: #ccc;
	padding: 10px 0;
}
.infoParams li > span:nth-child(1) {
  width: 100px;
}
.infoParams li > span:nth-child(2) {
  flex: 1;
  text-align: left;
  color: salmon;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
</style>
